#ifndef MOVINGOBJECT_H
#define MOVINGOBJECT_H

#include "ngl/Vector.h"

#include "StaticObject.h"


/// @file MovingObject.h
/// @brief represents an object that can move in the system, such as boids and predators
/// @author Perseedoss Rajiv
/// @version 1.0
/// @date 29.03.11
/// Revision History :
/// Initial Version 29.03.11
/// @class MovingObject
/// @brief inherited from StaticObject, adding functionalities for a moving object

class MovingObject : public StaticObject
{
public:
    /// @brief ctor
    /// @param[in] _pos the cartesian position of the object
    /// @param[in] _vel the velocity of the object
    MovingObject(
                    const ngl::Vector _pos = 0,
                    const ngl::Vector _vel = 0
                );

    /// @brief returns the velocity of the object
    inline ngl::Vector getVelocity() const { return m_velocity; }

    /// @brief add a velocity to the internal velocity of the object
    /// @param[in] _vel the increment velocity
    inline void addToVelocity(const ngl::Vector _vel) { m_velocity += _vel; }

    /// @brief reverses the internal velocity of the object
    inline void reverseVelocity() { m_velocity.reverse(); }

    /// @brief returns the angle of pitch of the object
    inline float getAngleOfPitch() const { return m_angleOfPitch; }

    /// @brief returns the angle of yaw of the object
    inline float getAngleOfYaw() const { return m_angleOfYaw; }


protected:
    /// @brief the velocity of the object
    ngl::Vector m_velocity;

    /// @brief the angle of pitch of the object
    float m_angleOfPitch;

    /// @brief the angle of yaw of the object
    float m_angleOfYaw;


protected:
    /// @brief moves the object by its internal velocity and add an increment to it
    /// @param[in] _velocity the increment velocity
    void move(const ngl::Vector _velocity);


private:
    /// @brief update the orientation of the object, pitch and yaw, from its internal velocity
    void updateOrientation();
};

#endif // MOVINGOBJECT_H
